package org.liang.base.listener;

import org.liang.auth.service.IPermissionScanService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

//ServletContextListener----------程序启动时会执行的监听器
@WebListener
public class PermissionScanListener implements ServletContextListener {
    @Autowired
    private IPermissionScanService permissionScanService;

    //contextInitialized---------监听程序启动时会执行的方法
    @Override
        public void contextInitialized(ServletContextEvent sce) {
        System.out.println("==============扫描开始================");
        permissionScanService.scan();
        System.out.println("==============扫描结束================");
    }
}
